﻿<UserControl x:Class="WPFEdit.Views.MenuBar"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             mc:Ignorable="d" 
             d:DesignHeight="50" d:DesignWidth="301">
    <Grid>
        <Menu ItemsSource="{Binding MenuItems}">
            <Menu.ItemContainerStyle>
                <Style  TargetType="{x:Type MenuItem}">
                    <Setter Property="Header" Value="{Binding Name}" />
                    <Setter Property="ItemsSource" Value="{Binding SubMenu}" />
                    <Setter Property="Command" Value="{Binding Command}" />
                    <Setter Property="IsEnabled" Value="{Binding Enabled}" />
                    <Setter Property="InputGestureText" Value="{Binding InputGestureText}"/>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Path=IsSeparator}" Value="true">
                            <Setter Property="MenuItem.Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type MenuItem}">
                                        <Separator Style="{DynamicResource {x:Static MenuItem.SeparatorStyleKey}}"/>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </DataTrigger>
                    </Style.Triggers>

                </Style>
            </Menu.ItemContainerStyle>
        </Menu>
    </Grid>
</UserControl>
